package com.kaishengit.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;


import com.kaishengit.pojo.Files;
import com.kaishengit.pojo.Filetype;

@Repository
public class FileDao extends BaseDao<Files, String> {

	public List<Files> getFiless(Filetype filetype) {
		
		String hql="from Files where filetypeid = :id Order by createtime desc";
		Query query = getSession().createQuery(hql);
		query.setParameter("id", filetype);
		
		@SuppressWarnings("unchecked")
		List<Files> fileList = query.list();
		return fileList;
	}
	public void dels(Filetype filetype) {
		System.out.println(filetype.getId());
		String hql="delete from Files where filetypeid = :id";
		Query query = getSession().createQuery(hql);
		query.setParameter("id", filetype.getId());
	}
	

}
